<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <input type="text" name="qqq" value="中国">
        <input type="text" name="qqq" value="北京">
        <button id="but">传参</button>
    </div>
    <script>
        function huan(e) {
             alert(e)
        }
         window.onload=function(){
               var qqqaaa=document.getElementsByName('qqq')
               var butt=document.getElementById('but')
               butt.onclick=function(){
                for(var i=0;i<qqqaaa.length;i++){
                   huan(qqqaaa[i].value)
                }
               }
         }
    </script>
   
</body>
</html>